package Chapter5;

public class Example11 {
	public static void main(String[] args){
		SaleThread saleThread=new SaleThread();
		new Thread(saleThread,"thread1").start();
		new Thread(saleThread,"thread2").start();
		new Thread(saleThread,"thread3").start();
		new Thread(saleThread,"thread4").start();
	}

}
class SaleThread implements Runnable{
	private int tickets=10;
	public void run() {
		while(tickets>0) {
			try {
				Thread.sleep(10);
			}catch(InterruptedException e) {
				e.printStackTrace();
			}
			System.out.println(Thread.currentThread().getName()+"---saled tickets"+tickets--);
		}
	}
}